home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 025a / oclip.zip / OCLIP.PRG < prev    next >
Text File  |  1991-11-25  |  3KB  |  87 lines

  1. /*
  2. ╔══════════════════════════════════════════════════════════════════════╗
  3. ║                                o:Clip                                ║
  4. ║             An Object Oriented Extension to Clipper 5.01             ║
  5. ║                 (c) 1991 Peter M. Freese, CyberSoft                  ║
  6. ╚══════════════════════════════════════════════════════════════════════╝
  7.  
  8. Version 1.0a - November 10, 1991
  9. */
  10.  
  11. EXTERNAL ;
  12.   __IVAR01,__IVAR02,__IVAR03,__IVAR04,__IVAR05,;
  13.   __IVAR06,__IVAR07,__IVAR08,__IVAR09,__IVAR10,;
  14.   __IVAR11,__IVAR12,__IVAR13,__IVAR14,__IVAR15,;
  15.   __IVAR16,__IVAR17,__IVAR18,__IVAR19,__IVAR20,;
  16.   __IVAR21,__IVAR22,__IVAR23,__IVAR24,__IVAR25,;
  17.   __IVAR26,__IVAR27,__IVAR28,__IVAR29,__IVAR30,;
  18.   __IVAR31,__IVAR32,__IVAR33,__IVAR34,__IVAR35,;
  19.   __IVAR36,__IVAR37,__IVAR38,__IVAR39,__IVAR40,;
  20.   __IVAR41,__IVAR42,__IVAR43,__IVAR44,__IVAR45,;
  21.   __IVAR46,__IVAR47,__IVAR48,__IVAR49,__IVAR50
  22. EXTERNAL ;
  23.   __SIVAR01,__SIVAR02,__SIVAR03,__SIVAR04,__SIVAR05,;
  24.   __SIVAR06,__SIVAR07,__SIVAR08,__SIVAR09,__SIVAR10,;
  25.   __SIVAR11,__SIVAR12,__SIVAR13,__SIVAR14,__SIVAR15,;
  26.   __SIVAR16,__SIVAR17,__SIVAR18,__SIVAR19,__SIVAR20,;
  27.   __SIVAR21,__SIVAR22,__SIVAR23,__SIVAR24,__SIVAR25,;
  28.   __SIVAR26,__SIVAR27,__SIVAR28,__SIVAR29,__SIVAR30,;
  29.   __SIVAR31,__SIVAR32,__SIVAR33,__SIVAR34,__SIVAR35,;
  30.   __SIVAR36,__SIVAR37,__SIVAR38,__SIVAR39,__SIVAR40,;
  31.   __SIVAR41,__SIVAR42,__SIVAR43,__SIVAR44,__SIVAR45,;
  32.   __SIVAR46,__SIVAR47,__SIVAR48,__SIVAR49,__SIVAR50
  33.  
  34. STATIC aClassList := {}, aMethodList := {}, aVarList := {}, nCurrent := 0
  35. STATIC oParent
  36.  
  37. FUNCTION __DefineClass(cName,bParent)
  38. LOCAL nParent
  39.   oParent := nil
  40.   if(bParent <> nil,oParent:= bParent:Eval(),) // ensure parent defined
  41.   AADD(aClassList,UPPER(cName))
  42.   AADD(aMethodList,{ {"__PARENT","__PARENT"} })
  43.   AADD(aVarList,{})
  44.   ++nCurrent
  45.   if bParent <> nil .and. ;
  46.     (nParent := ASCAN(aClassList,UPPER(oParent:ClassName))) <> 0
  47.     aMethodList[nCurrent] := ACLONE(aMethodList[nParent])
  48.     aVarList[nCurrent] := ACLONE(aVarList[nParent])
  49.   end
  50. RETURN oParent
  51.  
  52. PROCEDURE __AddVar(cName)
  53.   AADD(aVarList[nCurrent],cName)
  54. RETURN
  55.  
  56. PROCEDURE __AddMethod(cName,cUDF)
  57. LOCAL n
  58.   cName := UPPER(cName)
  59.   n := ASCAN(aMethodList[nCurrent], { |aMethod| aMethod[1] == cName } )
  60.   if n > 0
  61.     aMethodList[nCurrent,n] := {cName,cUDF} // override parent method
  62.   else
  63.     AADD(aMethodList[nCurrent],{cName,cUDF})
  64.   end
  65. RETURN
  66.  
  67. FUNCTION __MakeClass()
  68. LOCAL i := 0,cVar,s
  69. LOCAL nHandle := __ClassNew(aClassList[nCurrent],LEN(aVarList[nCurrent])+1)
  70.   AEVAL(aMethodList[nCurrent], ;
  71.     {|cMethod| __ClassAdd(nHandle,cMethod[1],cMethod[2]) } )
  72.   while i++ < LEN(aVarList[nCurrent])
  73.     cVar := aVarList[nCurrent,i]
  74.     s := PADL(LTRIM(STR(i+1)),2,"0")
  75.     __ClassAdd(nHandle,cVar,"__IVAR"+s)
  76.     __ClassAdd(nHandle,"_"+cVar,"__SIVAR"+s)
  77.   end
  78. RETURN nHandle
  79.  
  80. FUNCTION __PARENT(bParent)
  81. LOCAL r
  82.   if(LEN(QSELF())>1,ACOPY(QSELF(),QSELF()[1],2,,2),)
  83.   r := EVAL(bParent,QSELF()[1])
  84.   if(LEN(QSELF())>1,ACOPY(QSELF()[1],QSELF(),2,,2),)
  85. RETURN r
  86.  
  87.